// https://www.acwing.com/problem/content/850/

#include <iostream>
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;

const int MAX_N = 100010;

vector<vector<int>> G(MAX_N);
vector<int> inCounts(MAX_N);
unordered_set<int> nodes;

int main() {
    int m, n;
    int a, b;
    scanf("%d%d", &n, &m);
    for (int i=0; i<m; i++) {
        scanf("%d%d", &a, &b);
        G[a].push_back(b);
        nodes.insert(a);
        inCounts[b]++;
    }
    queue<int> Q;
    for (const auto& v: nodes) {
        if (inCounts[v] == 0) {
            Q.push(v);
        }
    }

    vector<int> ans;
    while (!Q.empty()) {
        auto front = Q.front();
        Q.pop();
        ans.push_back(front);
        for (auto v: G[front]) {
            inCounts[v]--;
            if (inCounts[v] == 0) {
                Q.push(v);
            }
        }
    }
    if (ans.size() == n) {
        for (int i=0; i<n; i++) {
            printf("%d ", ans[i]);
        }
    } else {
        printf("-1");
    }
    return 0;
}
